package com.eqs.enterprisequestionnaire.controller;

import com.eqs.enterprisequestionnaire.model.pojo.Option;
import com.eqs.enterprisequestionnaire.result.R;
import com.eqs.enterprisequestionnaire.service.DifferenceAnalysisService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/differenceAnalysis")
public class DifferenceAnalysisController {
    @Resource
    private DifferenceAnalysisService differenceAnalysisService;
    /*
    * 单个问题 性别差异分析
    * */
    @GetMapping("/differenceGender/{questionId}")
    public R<Map<String, Map<Boolean,Integer>>> differenceGender(@PathVariable Integer questionId){
        return R.success(differenceAnalysisService.getGenderDifference(questionId));
    }
    /*
     * 单个问题 年龄差异化分析
     * */
    @GetMapping("/differenceAge/{questionId}")
    public R<Map<String, Map<String,Integer>>> differenceAge(@PathVariable Integer questionId){
        return R.success(differenceAnalysisService.getAgeDifference(questionId));
    }
    /*
     * 单个问题 公司差异化分析
     * */
    @GetMapping("/differenceEnterprise/{questionId}")
    public R<Map<String, Map<String,Integer>>> differenceEnterprise(@PathVariable Integer questionId){
        return R.success(differenceAnalysisService.getEnterpriseDifference(questionId));
    }
    /*
     * 单个问题 职位差异化分析
     * */
    @GetMapping("/differenceRole/{questionId}")
    public R<Map<String, Map<String,Integer>>> differenceRole(@PathVariable Integer questionId){
        return R.success(differenceAnalysisService.getRoleDifference(questionId));
    }

    /*
     * 整个问卷 性别差异分析
     * */
    @GetMapping("/differenceGenderBig/{questionnaireId}")
    public R<Map<Boolean,Integer>> differenceGenderBig(@PathVariable Integer questionnaireId){
        return R.success(differenceAnalysisService.getGenderDifferenceBig(questionnaireId));
    }
    /*
     * 整个问卷 年龄差异分析
     * */
    @GetMapping("/differenceAgeBig/{questionnaireId}")
    public R<Map<String,Integer>> differenceAgeBig(@PathVariable Integer questionnaireId){
        return R.success(differenceAnalysisService.getAgeDifferenceBig(questionnaireId));
    }
    /*
     * 整个问卷 公司差异分析
     * */
    @GetMapping("/differenceEnterpriseBig/{questionnaireId}")
    public R<Map<String,Integer>> differenceEnterpriseBig(@PathVariable Integer questionnaireId){
        return R.success(differenceAnalysisService.getEnterpriseDifferenceBig(questionnaireId));
    }
    /*
     * 整个问卷 职位差异分析
     * */
    @GetMapping("/differenceRoleBig/{questionnaireId}")
    public R<Map<String,Integer>> differenceRoleBig(@PathVariable Integer questionnaireId){
        return R.success(differenceAnalysisService.getRoleDifferenceBig(questionnaireId));
    }
}
